climate = read.table("clim.txt", header=T)
Graphing Precipitation by Month
boxplot(climate$rain~climate$month,
xlab = "Month", ylab = "Precipitation (mm)", main = "Precipitation by Month, 1942-2016")

Graphing Average Temperature by Month
climate$Tavg <- (climate$tmin+climate$tmax)/2
boxplot(climate$Tavg~climate$month,
xlab ="Month", ylab = "Temperature (Degrees C)", main = "Temperature by Month, 1942-2016")

precip.year <- aggregate(climate$rain, by=list(climate$year), sum)
Wettest year: 1982
Total Precipitation: 2135.378mm
In that year, it might have looked like this all the time:
Driest year: 2013
Total Precipitation: 263.398mm
In that year, it might have looked like this all the time:
Precipitation by Season
climate$season <- ifelse(climate$month %in% c(12,1,2), "1",
ifelse(climate$month %in% c(3,4,5), "2",
ifelse(climate$month %in% c(6,7,8), "3", "4")))
boxplot(climate$rain~climate$season,
main = "Precipitation by Season", xlab = "Season", ylab = "Precipitation (mm)")

As seen in the box plot above, the wettest season is winter, and driest season is summer.
Relating summer temperatures to winter precipitation
winter.precip <- subset(climate, season == "1")
summer.temp <- subset(climate, season == "3")
#now let's try to aggregate
W_precip_by_year <- aggregate(winter.precip$rain, by=list(winter.precip$year), sum)
S_temp_by_year <- aggregate(summer.temp$Tavg, by=list(summer.temp$year), mean)
windows()
plot(S_temp_by_year$x~W_precip_by_year$x, main = "Winter Precipitation and Summer Temperature, 1949-2016", xlab = "Total Winter Precipitation (mm)", ylab = "Average Summer Temperature (Degrees C)")
abline(lm(S_temp_by_year$x~W_precip_by_year$x), col = "red")

There does not appear to be a strong relationship between winter precipitation and summer temperatures. As shown by the best-fit line in red, above, there is a slight negative correlation between winter precipitation and summer temperatues. However, this linear relationship is not significant (P = 0.617, Adjusted R-Squared = -0.01). If there was a significant relationship, then winter precipitation could be used as a predictor of summer temperatures, which could assist agricultural producers, among others, in planning out each year’s activities.